home *** CD-ROM | disk | FTP | other *** search
- /*
- ** $VER: $Id: PZ_MakeIFF_ECS.rexx,v 5.0 1993/11/12 01:14:16 chris Exp $
- ** Copyright (C) 1992, 1993 by Christian A. Weber, Zürich, Switzerland.
- ** REXX script internally used by PicZoo. Do not start manually.
- **
- ** You may wish to change MAXMEM for ADPro if you don't have enough RAM,
- ** and the delay after loading if you have a slow HD :)
- */
-
- options results
- arg adprodir filename destname maxwidth maxheight
- address 'ADPro'
-
-
- /*
- ** Set the desired screen dimensions. If we don't set them manually, we get
- ** the current text overscan values, which is just what we want!
- */
-
- /* maxwidth = 704 */
- /* maxheight = 468 */
-
-
- /*
- ** Make sure ADPro is running
- */
- IF ~show(ports,'ADPro') THEN
- DO
- Address COMMAND 'C:Assign ADPRO: '||adprodir
- Address COMMAND 'Run >NIL: ADPRO:ADPro MAXMEM=5000000 BEHIND'
- Address COMMAND 'C:Wait 5'
- IF ~show(ports,'ADPro') THEN EXIT
- END
-
-
- /*
- ** Screen types for ADPro
- */
- LORES = 0
- HIRES = 1
- LACE = 2
- PAL = 4
- XOVERSCAN = 8
- YOVERSCAN = 16
-
-
- /*
- ** Now load the picture ...
- */
- SCREEN_TYPE LORES
- LFORMAT 'UNIVERSAL'
- LOAD filename
-
- IF RC == 0 THEN DO
-
- /*
- ** Get the picture size
- */
- XSIZE
- origwidth = (ADPRO_RESULT*11) / 10 /* Correct aspect ratio for Amiga */
- YSIZE
- origheight = ADPRO_RESULT
-
-
- /*
- ** Now determine the new width and height, so the picture fits
- ** into maxwidth/maxheight
- */
- width = maxwidth
- height = (origheight * maxwidth) / origwidth
-
- IF height > maxheight THEN DO
- width = (origwidth * maxheight) / origheight
- height = maxheight
- END
-
-
- /*
- ** Now set the parameters for the screenmode depending on the picture's
- ** type (GRAY or COLOR)
- */
- IMAGE_TYPE
- IF WORD(ADPRO_RESULT,1) = "GRAY" THEN DO
- POFFSET 0
- PUSED 16
- PTOTAL 16
- POFFSET 0
- RENDER_TYPE 16
- SCREEN_TYPE HIRES + LACE + XOVERSCAN + YOVERSCAN
- END
- ELSE DO
- POFFSET 0
- PUSED 16
- PTOTAL HAM
- POFFSET 0
- RENDER_TYPE HAM
- SCREEN_TYPE LORES + LACE + XOVERSCAN + YOVERSCAN
- width = width / 2; /* Because it's lo-res */
- END
-
-
- /*
- ** Make sure we get the best dynamic range
- */
- OPERATOR DYNAMIC_RANGE 0 255
-
-
- /*
- ** Scale the image and render it
- */
- ABS_SCALE width height
-
- PSTATUS UNLOCKED
- DITHER 1 /* Floyd-Steinberg */
- EXECUTE
-
- /*
- ** Now save the result as IFF in the user's IFF directory
- */
- SFORMAT 'IFF'
- SAVE destname 'IMAGE'
-
- END
- ELSE DO
- say filename || ': not a picture'
- END
-
-